import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class makesendto {  
public static void main(String[] args) {  
JFrame f=new JFrame();//creating instance of JFrame  
f.setTitle("MakeSendTo");
          
JButton b=new JButton("Make Shortcut in Send to");//creating instance of JButton  
b.setBounds(0,100,400, 40);//x axis, y axis, width, height  

JButton b1=new JButton("Copy File into Send to");//creating instance of JButton  
b1.setBounds(0,150,400, 40);//x axis, y axis, width, height  
          
f.add(b);//adding button in JFrame  
f.add(b1);//adding button in JFrame  
          
b.addActionListener(new ActionListener(){
    final JFileChooser fc = new JFileChooser();
    private Component aComponent;
    public void actionPerformed(ActionEvent e){
        fc.showOpenDialog(aComponent);
        File file = fc.getSelectedFile();
        try (PrintWriter out = new PrintWriter("filename.txt")) {
            out.println(file);
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        }
        try {
            Runtime.getRuntime().exec("cmd /c start MakeShortcut.bat");
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }
});

b1.addActionListener(new ActionListener(){
    final JFileChooser fc = new JFileChooser();
    private Component aComponent;
    public void actionPerformed(ActionEvent e){
        fc.showOpenDialog(aComponent);
        File file = fc.getSelectedFile();
        try (PrintWriter out = new PrintWriter("filename.txt")) {
            out.println(file);
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        }
        try {
            Runtime.getRuntime().exec("cmd /c start MakeCopy.bat");
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }
});

f.setSize(400,500);//400 width and 500 height  
f.setLayout(null);//using no layout managers  
f.setVisible(true);//making the frame visible  
}  
}  